<template>
  <view class="main">
    <view style="display: flex; align-items: center; justify-content: center">
      <image src="" class="logo" mode="aspectFill" />
    </view>
    <view class="title">{{ appName }}</view>
    <view class="version">当前版本：{{ version }}</view>
    <u-cell-group :border="false">
      <u-cell title="用户协议" @click="goPage('/pages/myPage/userAgreement')" isLink></u-cell>
      <u-cell title="隐私政策" isLink @click="goPage('/pages/myPage/privacyAgreement')"></u-cell>
      <u-cell title="检查更新" isLink @click="jcgx"></u-cell>
    </u-cell-group>
  </view>
</template>

<script setup lang="ts">
import { goPage, checkForUpdates } from "@/utils/commonFn";
import { onMounted, ref } from "vue";
const version = ref("");
const appName = ref("");
onMounted(() => {
  const systemInfo = uni.getSystemInfoSync();
  version.value = systemInfo.appVersion;
  appName.value = systemInfo.appName;
});
const jcgx = () => {
  checkForUpdates().then((res: boolean) => {
    if (res) {
      uni.showToast({
        title: "已是最新版本",
        icon: "none",
      });
    }
  });
};
</script>

<style lang="less" scoped>
.logo {
  width: 120rpx;
  height: 120rpx;
  border-radius: 16rpx 16rpx 16rpx 16rpx;
  margin: 20rpx auto;
  margin-top: 80rpx;
}
.title {
  text-align: center;
  font-family: PingFang SC, PingFang SC;
  font-weight: 500;
  font-size: 32rpx;
  color: #333;
  line-height: 38rpx;
}
.version {
  font-family: PingFang SC, PingFang SC;
  font-weight: 400;
  font-size: 24rpx;
  color: #9694ae;
  line-height: 34rpx;
  text-align: center;
  margin-top: 18rpx;
}
/deep/.u-cell-group {
  margin-top: 20rpx;
  overflow: hidden;
  background: #fff;
}

/deep/ .u-cell-group__wrapper {
  padding: 0rpx 32rpx;
}

/deep/ .u-cell__body {
  padding: 36rpx 0rpx;
}

/deep/ .u-cell__title-text {
  font-size: 30rpx;
  font-family: PingFangSC-Regular, PingFang SC;
  color: #000;
}
:deep(.u-line) {
  border-color: #f9fafb !important;
}
</style>
